package com.theydream.ichingwisdom.ui;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.theydream.ichingwisdom.R;
import com.theydream.ichingwisdom.tab.TabHostProvider;
import com.theydream.ichingwisdom.tab.TabView;
import com.theydream.ichingwisdom.tab.TabbarView;


public class CardDetail extends Activity {
	private TabHostProvider tabProvider;
	private TabView tabView;
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		tabProvider = new TabbarView(this);
		tabView = tabProvider.getTabHost("main");
		tabView.setCurrentView(R.layout.card_detail);
		View view=tabView.render(4);
		//TextView mallName=(TextView) view.findViewById(R.id.txtTitle);
		//mallName.setText(GlobalData.getInstance().getMall_name());
		setContentView(view);
		LinearLayout mLinearLayout=(LinearLayout)findViewById(R.id.card);
		mLinearLayout.setBackgroundResource(GlobalData.getmThumbIds()[GlobalData.getShowCard()]);
		
		
		//TextView btnAboutUs=(TextView) findViewById(R.id.AboutUs);

		mLinearLayout.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				Dialog dialog = new Dialog(CardDetail.this);
				dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE);
				//dialog.getWindow().setBackgroundDrawableResource(R.color.TRANSPARENT);
//				dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
				WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();  
				lp.alpha=0.8f;  
				dialog.getWindow().setAttributes(lp);  
				dialog.setContentView(R.layout.about_dialog);
				// dialog.setTitle("About Us");
				TextView text0 = (TextView) dialog.findViewById(R.id.nametext);
				String str0 = "cardname"+ String.valueOf(GlobalData.getShowCard());
				
				text0.setText(CardDetail.this.getString(getResources().getIdentifier("cardname"+(GlobalData.getShowCard()+1), "string", getPackageName())));
				//String r = getResources().getString("R.cardname.cardname"+GlobalData.getShowCard());
//				text0.setText("Name: "+CardDetail.this.getString(getResources().getIdentifier("R.cardname.cardname"+GlobalData.getShowCard(), "string", "com.theydream.ichingwisdom.ui")));
				TextView text1 = (TextView) dialog.findViewById(R.id.imagetext);
				text1.setText(CardDetail.this.getString(getResources().getIdentifier("cardimage"+(GlobalData.getShowCard()+1), "string", getPackageName())));
				TextView text2 = (TextView) dialog.findViewById(R.id.meaningtext);
				text2.setText(CardDetail.this.getString(getResources().getIdentifier("cardmeaning"+(GlobalData.getShowCard()+1), "string", getPackageName())));
				TextView text3 = (TextView) dialog.findViewById(R.id.relationshiptext);
				text3.setText(CardDetail.this.getString(getResources().getIdentifier("cardmeaning"+(GlobalData.getShowCard()+1), "string", getPackageName())));
				dialog.show();
				
			}
		});
//		btnTerms.setOnClickListener(new OnClickListener() {
//			public void onClick(View v) {
//				startActivity(new Intent(Author.this,TermAndCond.class));
//			}
//		});
		
	}
	

	public void onResume()
	{
		super.onResume();
//		FlurryAgent.logEvent("0.Author");
	}
}
